From e483407cf11a45cc0e80acf9c34784cbc47f8bae Mon Sep 17 00:00:00 2001 From: tsteven4 <13596209+tsteven4@users.noreply.github.com> Date: Sun, 26 Jan 2020 08:04:36 -0700 Subject: [PATCH] fix some xcsv bugs. (#477) These led to non-sensical motoactv files in test-all. These non-sensical files lead to the discovery of a holux write passed end of buffer bug. 1. fea062ee7 writtime expects a strftime format specification. When writing XT_TIMET_TIME_MS with writtime the strpftime format specification ("%s") that was previously used was replaced by a printf format specification ("%ld"). Thus the twelve hour clock followed by a 'd' character was printed instead of the number of seconds since the Epoch. 2. 172073cdb When intending to print the field encloser the record delimiter printed instead. --- xcsv.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xcsv.cc b/xcsv.cc index 11d9c1ca5..00d976496 100644 --- a/xcsv.cc +++ b/xcsv.cc @@ -1539,7 +1539,7 @@ xcsv_waypt_pr(const Waypoint* wpt) case XT_TIMET_TIME_MS: { /* time as a time_t variable in milliseconds */ - buff = writetime("%ld", wpt->GetCreationTime().toTime_t(), false); + buff = writetime("%s", wpt->GetCreationTime().toTime_t(), false); buff += QString::asprintf("%03d", wpt->GetCreationTime().time().msec()); } @@ -1747,7 +1747,7 @@ xcsv_waypt_pr(const Waypoint* wpt) if (!xcsv_file.field_encloser.isEmpty()) { /* print the enclosing character(s) */ - *xcsv_file.stream << xcsv_file.record_delimiter; + *xcsv_file.stream << xcsv_file.field_encloser; } /* As a special case (pronounced "horrible hack") we allow @@ -1760,7 +1760,7 @@ xcsv_waypt_pr(const Waypoint* wpt) if (!xcsv_file.field_encloser.isEmpty()) { /* print the enclosing character(s) */ - *xcsv_file.stream << xcsv_file.record_delimiter; + *xcsv_file.stream << xcsv_file.field_encloser; } buff.clear(); } -- 2.30.2